package znbkBkfx.BKFX_YDJD;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.annotation.SuppressLint;
import android.support.v4.view.ViewPager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import android.webkit.WebView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.example.znbk.znbklibrary.base.AnswerViewPagerAdapter;
import com.example.znbk.znbklibrary.base.BaseFragment;
import com.example.znbk.znbklibrary.dialog.LoadingDialog;
import com.google.gson.Gson;
import com.lancoo.znbkxx.R;
import com.lancoo.znbkxx.beans.UserInfoBean;
import com.lancoo.znbkxx.net.URLConstant;

import java.util.ArrayList;
import java.util.List;

import okhttp3.RequestBody;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
import znbkBkfx.BkfxActivity;
import znbkBkfx.GetBkfxJson.BkfxPaperEntity;
import znbkBkfx.PostSaveSubjectiveQues.PostSaveSubjectiveItemQuesAnswer_interface;
import znbkBkfx.PostSaveSubjectiveQues.ResultSubjectiveItemJson;
import znbkBkfx.PostSaveSubjectiveQues.SubjectiveItemAnswerModel;

@SuppressLint("ValidFragment")
public class BkfxYdjdFragment extends BaseFragment {

    private String QuesBody = "";
    private String ChildAsk = "";
    private String SubChildAsk = "";
    private void getEntityInfor(){
        QuesBody = bkfxPaperEntity.getQuesList().get(quesIndex).getQuesBody();
        ChildAsk = bkfxPaperEntity.getQuesList().get(quesIndex).getChildList().get(0).getChildAsk();
        SubChildAsk = bkfxPaperEntity.getQuesList().get(quesIndex).getChildList().get(0).getSubChildList().get(0).getSubChildAsk();
    }

    private BkfxPaperEntity bkfxPaperEntity;
    private int quesIndex = -1;
    private CallBackFragmentYdjd callBackFragmentYdjd;
    public BkfxYdjdFragment(BkfxPaperEntity bkfxPaperEntity, final int quesIndex,CallBackFragmentYdjd callBackFragmentYdjd){
        this.bkfxPaperEntity = bkfxPaperEntity;
        this.quesIndex = quesIndex;
        this.callBackFragmentYdjd = callBackFragmentYdjd;
        getEntityInfor();
    }

    @Override
    protected int createLayout() {
        return R.layout.bkfx_fragment_ydjd;
    }

    private WebView mWvQuesBody;
    private ViewPager mVpAnswer;
    private ArrayList<View> list;
    public AnswerViewPagerAdapter mAnswerViewPagerAdapter;
    private Button mBtnSubmit;

    private LinearLayout mLlResultStuScore;
    private LoadingDialog mLoadingDialog;
    @Override
    protected void initView(View view) {

        //显示Ask题干
        mWvQuesBody = view.findViewById(R.id.wv_quesBody);
        mWvQuesBody.setBackgroundColor(0); // 设置背景色
        mWvQuesBody.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
        String WvQuesBody = QuesBody+ChildAsk+SubChildAsk;
        mWvQuesBody.loadData(WvQuesBody+"</br></br>", "text/html", "utf-8");

        //显示Answer信息
        mVpAnswer = view.findViewById(R.id.vp_answerYdjd);
        list = new ArrayList<>();
        list.clear();
        int totalItemCount = bkfxPaperEntity.getQuesList().get(quesIndex).getTotalItemCount();
        for (int i = 0; i < totalItemCount; i++) {
            RecyclerView mRvAnswer = new RecyclerView(getActivity());
            mRvAnswer.setLayoutManager(new LinearLayoutManager(getActivity()));//必须先设置LayoutManager
            BkfxYdjdAnswerAdapter mAnswerAdapter = new BkfxYdjdAnswerAdapter(getActivity(),
                    bkfxPaperEntity,quesIndex,i);
            mRvAnswer.setAdapter(mAnswerAdapter);
            list.add(mRvAnswer);
        }
        mAnswerViewPagerAdapter = new AnswerViewPagerAdapter(list);
        mVpAnswer.setAdapter(mAnswerViewPagerAdapter);
        bkfxPaperEntity.getPaperAnswer().get(quesIndex).setCurrentSubChildAnswerIndex(0);
        mVpAnswer.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int i, float v, int i1) {

            }

            @Override
            public void onPageSelected(int i) {
                bkfxPaperEntity.getPaperAnswer().get(quesIndex).setCurrentSubChildAnswerIndex(i);
            }

            @Override
            public void onPageScrollStateChanged(int i) {

            }
        });

        mBtnSubmit = view.findViewById(R.id.btn_submit);
        int SubmitState = bkfxPaperEntity.getPaperAnswer().get(quesIndex).getSubmitState();
        if(SubmitState==2){
            mBtnSubmit.setVisibility(View.GONE);
        }else{
            mBtnSubmit.setVisibility(View.VISIBLE);
        }
        mBtnSubmit.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                switch (event.getAction()) {
                    case MotionEvent.ACTION_DOWN:
                        ObjectAnimator scalexShow =  ObjectAnimator.ofFloat(mBtnSubmit,View.SCALE_X,1f,1.1f);
                        ObjectAnimator scaleYShow =  ObjectAnimator.ofFloat(mBtnSubmit,View.SCALE_Y,1f,1.1f);
                        AnimatorSet setShow = new AnimatorSet();
                        setShow.playTogether(scalexShow,scaleYShow);
                        setShow.setInterpolator(new DecelerateInterpolator());
                        setShow.setDuration(100);
                        setShow.start();
                        break;
                    case MotionEvent.ACTION_UP:
                        mLoadingDialog = new LoadingDialog(getActivity(),false,false,"智能评测中...");
                        mLoadingDialog.show();

                        bkfxPaperEntity.getPaperAnswer().get(quesIndex).setSubmitState(2);
//                        RefreshAdapterView();
//                        callBackFragmentYdjd.saveSubjectiveItemQuesAnswer();

                        ObjectAnimator scalexShow1 =  ObjectAnimator.ofFloat(mBtnSubmit,View.SCALE_X,1.1f,1f);
                        ObjectAnimator scaleYShow1 =  ObjectAnimator.ofFloat(mBtnSubmit,View.SCALE_Y,1.1f,1f);
                        AnimatorSet setShow1 = new AnimatorSet();
                        setShow1.playTogether(scalexShow1,scaleYShow1);
                        setShow1.setInterpolator(new DecelerateInterpolator());
                        setShow1.setDuration(300);
                        setShow1.addListener(new Animator.AnimatorListener() {
                            @Override
                            public void onAnimationStart(Animator animation) {

                            }

                            @Override
                            public void onAnimationEnd(Animator animation) {
                                mBtnSubmit.setVisibility(View.GONE);
                                SaveBkfx_ZgtQuesAnswer(quesIndex);
                            }

                            @Override
                            public void onAnimationCancel(Animator animation) {

                            }

                            @Override
                            public void onAnimationRepeat(Animator animation) {

                            }
                        });
                        setShow1.start();

                        break;
                }
                return true;
            }
        });

        //学生作答得分
        mLlResultStuScore = view.findViewById(R.id.ll_resultStuScore);
    }



    public interface CallBackFragmentYdjd {
        void pageMoveNext();
        void saveSubjectiveItemQuesAnswer();
    }

    public void RefreshAdapterView() {

            list = new ArrayList<>();
            list.clear();
            int totalItemCount = bkfxPaperEntity.getQuesList().get(quesIndex).getTotalItemCount();
            for (int i = 0; i < totalItemCount; i++) {
                RecyclerView mRvAnswer = new RecyclerView(getActivity());
                mRvAnswer.setLayoutManager(new LinearLayoutManager(getActivity()));//必须先设置LayoutManager
                BkfxYdjdAnswerAdapter mAnswerAdapter = new BkfxYdjdAnswerAdapter(getActivity(),
                        bkfxPaperEntity,quesIndex,i);
                mRvAnswer.setAdapter(mAnswerAdapter);
                list.add(mRvAnswer);
            }
            mAnswerViewPagerAdapter = new AnswerViewPagerAdapter(list);
            mVpAnswer.setAdapter(mAnswerViewPagerAdapter);

            //跳转到指定页面
            int CurrentSubChildAnswerIndex = bkfxPaperEntity.getPaperAnswer().get(quesIndex).getCurrentSubChildAnswerIndex();
            Log.e("AnswerIndexAAA","================CurrentSubChildAnswerIndex================"+CurrentSubChildAnswerIndex);
            mVpAnswer.setCurrentItem(CurrentSubChildAnswerIndex);
    }


    //保存大数据评阅作答信息
    private void SaveBkfx_ZgtQuesAnswer(int position) {

        String TypeNo = bkfxPaperEntity.getQuesList().get(position).getTypeInfo().getTypeNo();
        List<SubjectiveItemAnswerModel.ModelListBean> ModelList = new ArrayList<>();
        if(TypeNo.equals("f")||TypeNo.equals("V")||TypeNo.equals("X")||TypeNo.equals("d")||TypeNo.equals("g")){

            List<SubjectiveItemAnswerModel.ModelListBean.ChildListBean> ChildList = new ArrayList<>();
            int ChildListSize = bkfxPaperEntity.getQuesList().get(position).getChildList().size();
            for(int i=0;i<ChildListSize;i++) {
                SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean.SubChildItemBean subChildItemBean =
                        new SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean.SubChildItemBean();
                String AudioPath = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().
                        get(i).getSubChildList().get(0).getSubChildItem().get(0).getAudioPath();
                String ImagePath = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().
                        get(i).getSubChildList().get(0).getSubChildItem().get(0).getImagePath();
                String ItemAnswer = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().
                        get(i).getSubChildList().get(0).getSubChildItem().get(0).getItemAnswer();
                int ItemIndex = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().
                        get(i).getSubChildList().get(0).getSubChildItem().get(0).getItemIndex();
                String StuAnswer = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().
                        get(i).getSubChildList().get(0).getSubChildItem().get(0).getStuAnswer();
                subChildItemBean.setAudioPath(AudioPath);
                subChildItemBean.setImagePath(ImagePath);
                subChildItemBean.setItemAnswer(ItemAnswer);
                subChildItemBean.setItemIndex(ItemIndex);
                subChildItemBean.setScoreRate(0);
                subChildItemBean.setStuAnswer(StuAnswer);
                List<SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean.SubChildItemBean> SubChildItem = new ArrayList<>();
                SubChildItem.add(subChildItemBean);

                SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean subChildListBean =
                        new SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean();
                int SubChildIndex = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().get(i).
                        getSubChildList().get(0).getSubChildIndex();
                subChildListBean.setSubChildIndex(SubChildIndex);
                subChildListBean.setSubChildItem(SubChildItem);
                List<SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean> SubChildList = new ArrayList<>();
                SubChildList.add(subChildListBean);

                SubjectiveItemAnswerModel.ModelListBean.ChildListBean childListBean =
                        new SubjectiveItemAnswerModel.ModelListBean.ChildListBean();
                int ChildIndex = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().get(i).getChildIndex();
                childListBean.setChildIndex(ChildIndex);
                childListBean.setSubChildList(SubChildList);

                ChildList.add(childListBean);

            }



            SubjectiveItemAnswerModel.ModelListBean modelListBean = new SubjectiveItemAnswerModel.ModelListBean();
            String GenreID = bkfxPaperEntity.getQuesList().get(position).getGenreInfo().getGenreID();
            String QuesID = bkfxPaperEntity.getQuesList().get(position).getQuesID();
            modelListBean.setCorrectRate(0);//待传
            modelListBean.setDuration(0);//待传
            modelListBean.setGenreID(GenreID);
            modelListBean.setQuesID(QuesID);
            modelListBean.setTypeNo(TypeNo);
            modelListBean.setChildList(ChildList);
            ModelList.add(modelListBean);

        }else if(TypeNo.equals("b")||TypeNo.equals("k")){
            List<SubjectiveItemAnswerModel.ModelListBean.ChildListBean> ChildList = new ArrayList<>();
            int ChildListSize = bkfxPaperEntity.getQuesList().get(position).getChildList().size();
            for(int i=0;i<ChildListSize;i++) {

                List<SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean.SubChildItemBean> SubChildItem = new ArrayList<>();
                int SubChildItemSize = bkfxPaperEntity.getQuesList().get(position).getChildList().
                        get(i).getSubChildList().get(0).getSubChildItem().size();
                for(int j=0;j<SubChildItemSize;j++){
                    SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean.SubChildItemBean subChildItemBean =
                            new SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean.SubChildItemBean();
                    String AudioPath = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().
                            get(i).getSubChildList().get(0).getSubChildItem().get(j).getAudioPath();
                    String ImagePath = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().
                            get(i).getSubChildList().get(0).getSubChildItem().get(j).getImagePath();
                    String ItemAnswer = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().
                            get(i).getSubChildList().get(0).getSubChildItem().get(j).getItemAnswer();
                    int ItemIndex = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().
                            get(i).getSubChildList().get(0).getSubChildItem().get(j).getItemIndex();
                    String StuAnswer = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().
                            get(i).getSubChildList().get(0).getSubChildItem().get(j).getStuAnswer();
                    subChildItemBean.setAudioPath(AudioPath);
                    subChildItemBean.setImagePath(ImagePath);
                    subChildItemBean.setItemAnswer(ItemAnswer);
                    subChildItemBean.setItemIndex(ItemIndex);
                    subChildItemBean.setScoreRate(0);
                    subChildItemBean.setStuAnswer(StuAnswer);

                    SubChildItem.add(subChildItemBean);
                }


                SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean subChildListBean =
                        new SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean();
                int SubChildIndex = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().get(i).
                        getSubChildList().get(0).getSubChildIndex();
                subChildListBean.setSubChildIndex(SubChildIndex);
                subChildListBean.setSubChildItem(SubChildItem);
                List<SubjectiveItemAnswerModel.ModelListBean.ChildListBean.SubChildListBean> SubChildList = new ArrayList<>();
                SubChildList.add(subChildListBean);

                SubjectiveItemAnswerModel.ModelListBean.ChildListBean childListBean =
                        new SubjectiveItemAnswerModel.ModelListBean.ChildListBean();
                int ChildIndex = bkfxPaperEntity.getPaperAnswer().get(position).getChildList().get(i).getChildIndex();
                childListBean.setChildIndex(ChildIndex);
                childListBean.setSubChildList(SubChildList);

                ChildList.add(childListBean);

            }



            SubjectiveItemAnswerModel.ModelListBean modelListBean = new SubjectiveItemAnswerModel.ModelListBean();
            String GenreID = bkfxPaperEntity.getQuesList().get(position).getGenreInfo().getGenreID();
            String QuesID = bkfxPaperEntity.getQuesList().get(position).getQuesID();
            modelListBean.setCorrectRate(0);//待传
            modelListBean.setDuration(0);//待传
            modelListBean.setGenreID(GenreID);
            modelListBean.setQuesID(QuesID);
            modelListBean.setTypeNo(TypeNo);
            modelListBean.setChildList(ChildList);
            ModelList.add(modelListBean);
        }


        SubjectiveItemAnswerModel subjectiveItemAnswerModel = new SubjectiveItemAnswerModel();
        subjectiveItemAnswerModel.setCourseClassID(UserInfoBean.CourseClassID);
        subjectiveItemAnswerModel.setGlobalGrade(UserInfoBean.GlobalGrade);
        subjectiveItemAnswerModel.setKey(UserInfoBean.Key);
        int PaperDuration = Integer.valueOf(BkfxActivity.getChronometerSeconds(BkfxActivity.mChronometerAnswerTime));
        subjectiveItemAnswerModel.setPaperDuration(PaperDuration);
        subjectiveItemAnswerModel.setStuID(UserInfoBean.StuId);
        subjectiveItemAnswerModel.setSchoolID(UserInfoBean.SchoolID);
        subjectiveItemAnswerModel.setSubjectID(UserInfoBean.SubjectID);
        subjectiveItemAnswerModel.setPaperID(bkfxPaperEntity.getPaperID());
        subjectiveItemAnswerModel.setModelList(ModelList);

        Gson gson=new Gson();
        String BODY= gson.toJson(subjectiveItemAnswerModel);
        Log.e("==BODYAA=","========BODY====请求参数=====AAAAA=============="+BODY);
        String BASE_URL = URLConstant.BASE_URL;
        Retrofit retrofit=new Retrofit.Builder()
                .baseUrl(BASE_URL)
                .addConverterFactory( GsonConverterFactory.create())
                .build();
        PostSaveSubjectiveItemQuesAnswer_interface postRequest = retrofit.create(PostSaveSubjectiveItemQuesAnswer_interface.class);
        RequestBody body=RequestBody.create(okhttp3.MediaType.parse("application/json; charset=utf-8"),BODY);
        Call<List<ResultSubjectiveItemJson>> call = postRequest.saveSubjectiveItemQuesAnswer(body);
        call.enqueue(new Callback<List<ResultSubjectiveItemJson>>() {
            @Override
            public void onResponse(Call<List<ResultSubjectiveItemJson>> call, Response<List<ResultSubjectiveItemJson>> response) {
                Log.e("onResponse=","===============大数据评阅结果：============="+response);
                String TypeNo = bkfxPaperEntity.getQuesList().get(quesIndex).getTypeInfo().getTypeNo();
                double StuScoreAll = 0;
                int Size = response.body().size();
                for(int i=0;i<Size;i++){
                    StuScoreAll = StuScoreAll + response.body().get(i).getScore();
                    double ScoreRate = response.body().get(i).getScoreRate();
                    if(TypeNo.equals("b")){
                        bkfxPaperEntity.getPaperAnswer().get(quesIndex).getChildList().
                                get(0).getSubChildList().get(0).getSubChildItem().get(i).setScoreRate(ScoreRate);
                    }else {
                        bkfxPaperEntity.getPaperAnswer().get(quesIndex).getChildList().
                                get(i).getSubChildList().get(0).getSubChildItem().get(0).setScoreRate(ScoreRate);
                    }
                }
                mLoadingDialog.dismiss();
                RefreshAdapterView();

                showResultStuScore(StuScoreAll);
            }

            @Override
            public void onFailure(Call<List<ResultSubjectiveItemJson>> call, Throwable t) {
                Log.e("onFailure", t.getMessage());
            }
        });

    }

    private void showResultStuScore(double stuScore){

        String strStuScore = String.valueOf(stuScore);
        if (strStuScore.contains("."))
        {
            String [] newStuScore = strStuScore.split("\\.");
            String front_stuScore = newStuScore[0];
            if(Integer.valueOf(front_stuScore)>=0 && Integer.valueOf(front_stuScore)<=9){
                drawStuScore(front_stuScore);
            }else{
                String str_front_stuScore_0 = front_stuScore.substring(0,1);
                drawStuScore(str_front_stuScore_0);
                String str_front_stuScore_1 = front_stuScore.substring(1,2);
                drawStuScore(str_front_stuScore_1);
            }
            String after_stuScore = newStuScore[1];
            if(Integer.valueOf(after_stuScore)>0){
                ImageView mIv_point = new ImageView(getActivity());
                mIv_point.setImageResource(R.mipmap.stu_score_point);
                mLlResultStuScore.addView(mIv_point);

                ImageView mIv_5 = new ImageView(getActivity());
                mIv_5.setImageResource(R.mipmap.stu_score_5);
                mLlResultStuScore.addView(mIv_5);

            }
        }

        ObjectAnimator translationXShow =  ObjectAnimator.ofFloat(mLlResultStuScore,View.TRANSLATION_X,500f,0f);
        ObjectAnimator alphaShow =  ObjectAnimator.ofFloat(mLlResultStuScore,View.ALPHA,0.6f,1.0f);
        AnimatorSet setShow = new AnimatorSet();
        setShow.playTogether(translationXShow,alphaShow);
        setShow.setInterpolator(new DecelerateInterpolator());
        setShow.setDuration(1600);
        setShow.addListener(new Animator.AnimatorListener() {
            @Override
            public void onAnimationStart(Animator animation) {
                mLlResultStuScore.setVisibility(View.VISIBLE);
                BkfxActivity.mVpBkfx.setScrollble(false);
            }

            @Override
            public void onAnimationEnd(Animator animation) {
                mLlResultStuScore.setVisibility(View.GONE);
                callBackFragmentYdjd.pageMoveNext();
                BkfxActivity.mVpBkfx.setScrollble(true);
            }

            @Override
            public void onAnimationCancel(Animator animation) {

            }

            @Override
            public void onAnimationRepeat(Animator animation) {

            }
        });
        setShow.start();

        Log.e("showResultStuScore","=======tlxz=========stuScore==============="+stuScore);

    }

    private void drawStuScore(String score){
        if(score.equals("0")){
            ImageView mIv_0 = new ImageView(getActivity());
            mIv_0.setImageResource(R.mipmap.stu_score_0);
            mLlResultStuScore.addView(mIv_0);
        }else if(score.equals("1")){
            ImageView mIv_1 = new ImageView(getActivity());
            mIv_1.setImageResource(R.mipmap.stu_score_1);
            mLlResultStuScore.addView(mIv_1);
        }else if(score.equals("2")){
            ImageView mIv_2 = new ImageView(getActivity());
            mIv_2.setImageResource(R.mipmap.stu_score_2);
            mLlResultStuScore.addView(mIv_2);
        }else if(score.equals("3")){
            ImageView mIv_3 = new ImageView(getActivity());
            mIv_3.setImageResource(R.mipmap.stu_score_3);
            mLlResultStuScore.addView(mIv_3);
        }else if(score.equals("4")){
            ImageView mIv_4 = new ImageView(getActivity());
            mIv_4.setImageResource(R.mipmap.stu_score_4);
            mLlResultStuScore.addView(mIv_4);
        }else if(score.equals("5")){
            ImageView mIv_5 = new ImageView(getActivity());
            mIv_5.setImageResource(R.mipmap.stu_score_5);
            mLlResultStuScore.addView(mIv_5);
        }else if(score.equals("6")){
            ImageView mIv_6 = new ImageView(getActivity());
            mIv_6.setImageResource(R.mipmap.stu_score_6);
            mLlResultStuScore.addView(mIv_6);
        }else if(score.equals("7")){
            ImageView mIv_7 = new ImageView(getActivity());
            mIv_7.setImageResource(R.mipmap.stu_score_7);
            mLlResultStuScore.addView(mIv_7);
        }else if(score.equals("8")){
            ImageView mIv_8 = new ImageView(getActivity());
            mIv_8.setImageResource(R.mipmap.stu_score_8);
            mLlResultStuScore.addView(mIv_8);
        }else if(score.equals("9")){
            ImageView mIv_9 = new ImageView(getActivity());
            mIv_9.setImageResource(R.mipmap.stu_score_9);
            mLlResultStuScore.addView(mIv_9);
        }
    }


}